package com.yangjiayu;

import com.yangjiayu.mcp.tool.DateTool;
import com.yangjiayu.mcp.tool.EmailTool;
import com.yangjiayu.mcp.tool.ProductTool;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @Classname Application
 * @Description TODO
 * @Date 2025/8/12 19:53
 * @Created by YangJiaYu
 */
@SpringBootApplication
@MapperScan("com.yangjiayu.mapper")
public class Application {

    //http://localhost:9060/sse

    public static void main(String[] args){

        SpringApplication.run(Application.class,args);
    }

    /**
     * 注册MCP工具
     * @param dateTool
     * @return
     */
    @Bean
    public ToolCallbackProvider registMCPTools(DateTool dateTool,EmailTool emailTool, ProductTool productTool){
        return MethodToolCallbackProvider.builder()
            .toolObjects(dateTool, emailTool,productTool)
            .build();
    }



}
